package classes
{
	import mx.collections.ArrayCollection;
	
	[Bindable] public class Gallery
	{
		public var mainphoto:String;
		public var title:String;
		public var description:String;
		public var photos:ArrayCollection;

		private var photo:Photo;
		
		public function Gallery(gallery:Object=null)
		{
			photos = new ArrayCollection();
			if (gallery != null)
			{
				set_properties(gallery);
			}
		}
		
		public function set_properties(gallery:Object):void
		{
			this.mainphoto = gallery.mainphoto;
			this.title = gallery.title;
			this.description = gallery.description;
			
			for (var i:int=0; i < gallery.photos.photo.length(); i++)
			{
				photo = new Photo(gallery.photos.photo[i]);
				photos.addItem(photo);
			}
		}
	}
}